package fair.jobs;

import com.alibaba.dubbo.config.annotation.Reference;
import fair.pojo.OrderSetting;
import fair.service.OrderSettingService;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

/**
 * @author fair_wu
 * @version v1.0
 * @package fair.jobs
 * @date 2021-01-28 下午 20:14
 */
public class ClearOrderJob {

    @Reference
    private OrderSettingService service;

    public void clearOrder(){
        Calendar calendar = Calendar.getInstance();
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
        String beginTime = calendar.get(Calendar.YEAR)+"-01-01";
        String endTime = simpleDateFormat.format(calendar.getTime());
        service.deletePastOrder(beginTime, endTime);

    }
}
